import { Alova } from '@/utils/http/alova';

export interface Algorithm {
  id: number;
  code: number;
  englishName: string;
  chineseName: string;
  level: number;
  version: string;
  default_params: string;
}

export interface PaginationParams {
  page: number;
  pageSize: number;
}

/**
 * @description: 获取算法列表
 * @param params 分页参数
 * @returns 包含算法列表和总数的响应对象
 */
export function GetAlgorithms(params: PaginationParams) {
  return Alova.Get<Algorithm[]>('/algorithm/list', {
    params: {
      isInstalled: true,
      page: params.page,
      pageSize: params.pageSize,
    },
  });
}

// 获取分组列表
export async function CreateAlgorithm() {
  return Alova.Post('/algorithm/create');
}

// 获取分组列表
export async function EditAlgParams(id, default_params) {
  return Alova.Post('/algorithm/update/' + id, { default_params });
}
